#/bin/bash

##echo "$USER"
if [ "$USER" != root ] ;then
  echo "请使用root用户"
  exit
fi

if [ "$1" == "" ]; then
   echo "Usage: ./ssh-keygen.sh 你的邮箱或者生成的key"
   exit
fi

if [ ! -d ~/.ssh ];then
 mkdir ~/.ssh
fi

ssh-keygen -t rsa -C "$1"

echo 公钥生成成功,请将下面的字符串复制到git库部署公钥中:


cat ~/.ssh/id_rsa.pub
